﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="User_Add.aspx.cs" Inherits="newBlog.admin.User.User_Add" %>

<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="newBlog.CenterInc.tool" %>
<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Register Src="~/model/allLink.ascx" TagPrefix="uc1" TagName="allLink" %>
<%
    string user_id = Request.QueryString["user_id"] == null || Request.QueryString["user_id"].Length == 0 ? "" : Request.QueryString["user_id"];
    List<User_msgDao> list = null;
    if (user_id.Length != 0)
    {

        User_inc user_Inc = new User_inc();
        list = user_Inc.EditUserMsg(user_id);
    }
    Grade_inc grade_Inc = new Grade_inc();
    List<Grade_Dao> listGrade = grade_Inc.gradeList();
    int count = listGrade.Count;
    int i = 0;
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户添加-<%=Application["title"] %></title>
    <meta name="description" content="<%=Application["content"] %>">
    <meta name="keywords" content="<%=Application["key"] %>">
    <uc1:allLink runat="server" ID="allLink" />
    <script src="/js/admin/User_preview.js?<%=DateTime.Now.ToString("yyyyMMddHHmmssffff") %>"></script>
</head>
<body>
    <div class="layui-row layui-form">

        <div class="layui-col-md6 layui-col-md-offset3 ">
            <div class="layui-panel layui-clear">
                <div class="layui-row RowDownSpace RowSpace">
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">用户名：</label></div>
                    <div class="layui-col-md10 layui-col-xs10">
                        <input type="text" id="user_name" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input" value="<%=user_id.Length!=0?list[0].Name:"" %>" <%=user_id.Length!=0?"disabled":"" %>>
                    </div>
                </div>
                <!--用户名-->
                <div class="layui-row RowDownSpace">
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">密码：</label></div>
                    <div class="layui-col-md10 layui-col-xs10">
                        <input type="password" id="NewPassword" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--密码-->
                <div class="layui-row RowDownSpace">
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">确认密码：</label></div>
                    <div class="layui-col-md10 layui-col-xs10">
                        <input type="password" id="RePassword" required lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <!--确认密码-->
                <div class="layui-row RowDownSpace">
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">邮箱：</label></div>
                    <div class="layui-col-md10 layui-col-xs10">
                        <input type="email" id="email" required lay-verify="required" placeholder="请输入带有@的邮箱" autocomplete="off" class="layui-input" value="<%=user_id.Length!=0?list[0].Email:"" %>">
                    </div>
                </div>
                <!--邮箱-->
                <div class="layui-row RowDownSpace">
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">余额：</label></div>
                    <div class="layui-col-md4 layui-col-xs4">
                        <input type="text" id="balance" required lay-verify="required" placeholder="请输入用户初始余额" autocomplete="off" class="layui-input" value="<%=user_id.Length!=0?list[0].Balance:"" %>">
                    </div>
                    <div class="layui-col-md2 layui-col-xs2">
                        <label class="text-left">权限：</label></div>
                    <div class="layui-col-md4 layui-col-xs4">
                        <select id="grade" lay-verify="">
                            <option value="">请选择用户权限</option>
                            <%
                                i = 0;
                                for (; i < count; i++)
                                {
                            %>
                            <option value="<%=listGrade[i].Id %>" <%=user_id.Length!=0?Convert.ToInt32(listGrade[i].Id)==Convert.ToInt32(list[0].Grade)?"selected":"":"" %>><%=listGrade[i].Name %></option>
                            <%
                                }


                            %>
                        </select>
                    </div>
                </div>
                <!--余额和权限-->


            </div>
            <!--面板结束-->
            <div class="layui-panel RowSpace">
                <%          if (user_id.Length != 0)
                    {


                %>
                <div class="layui-row">
                    <button type="button" class="layui-btn layui-btn-normal layui-btn-fluid" onclick="User_edit(<%=user_id %>)">更新用户</button>
                </div>
                <%
                    }

                %>
            </div>
            <!--按钮面板-->
        </div>
        <!--保住整个表单定位-->
    </div>
    <!--表单-->
</body>
</html>
